#include <unistd.h>
#include <stdio.h>

#include "contr_suite.h"

int main(void) {
    int fd;

    fd = openFile();
    //setTio(fd);

    for (;;) {
        char buf[200];
        int i;
        int results[8];
        for (i = 0; i < 8; i++) {
            buf[sprintf(buf, "analog %d\n\n", i)] = 0;
            sendMessage(buf, fd);
            getMessage(fd, buf, 200);
            results[i] = atoi(buf + 3);
        }
        for (i = 0; i < 8; i++)
            printf("%6d", results[i]);
        printf("\n");
        sleep(1);
    }
    close(fd);
    return 0;
}
